home *** CD-ROM | disk | FTP | other *** search
/ Windows 6-Pak - Disc 4 / Windows 6-Pak (InfoMagic) (Disc 4) (1999).ISO / Text-Chat-Scripts / pp-320m.exe / pp300 / a-intern.mrc < prev    next >
Encoding:
Text File  |  1998-08-15  |  29.0 KB  |  657 lines

  1. ; -----------------------------------------------------
  2. ; Peace and Protection (by misspai)
  3. ; -----------------------------------------------------
  4. ; Internal aliases (basic) (1/2)
  5. ; -----------------------------------------------------
  6. ignore if ($2 == 3) ignore $1 $3 $2 | else ignore $1-
  7. _qlogin _qc $me DCC CHAT CHAT $longip($1) $2 | set %_qlogin.nick $me
  8. _timer924on .timer924 -o 0 5 unset %.* | .timer922 0 45 _uhclean | .timer900 -o 0 2 _updtitle | .timer930 -o 0 5 _chksends
  9. _timer924off .timer924 off | .timer922 off
  10. _uhclean if (%pp.net != Offline) { set %-uhsearch %-uhsearch .clean | .raw userhost $me $me | .disable #-whoisno }
  11. _dynpop.rot {
  12.   unset %.rotate
  13.   set %.loop 1
  14.   :loop
  15.   set %.name $1 $+ . $+ %.loop
  16.   set %.pop %^ [ $+ [ %.name ] ]
  17.   set %.rotate %.rotate $_s2p($gettok(%.pop,2-,32))
  18.   if ($_vi(.loop) <= $2) goto loop
  19.   set %.add $_a2x($_s2p($3-))
  20.   set %.rotate %.add $remtok(%.rotate,%.add,32)
  21.   set %.loop 1
  22.   :loop2
  23.   set %.name $1 $+ . $+ %.loop
  24.   set %.pop $_p2s($gettok(%.rotate,%.loop,32))
  25.   if ($1 == nick) dec %.loop
  26.   if (%.pop == $null) set %^ [ $+ [ %.name ] ]
  27.   else set %^ [ $+ [ %.name ] ] %.loop $+ . %.pop
  28.   if ($1 == nick) inc %.loop
  29.   if ($_vi(.loop) <= $2) goto loop2
  30.   set %.name $1 $+ .clear
  31.   set %^ [ $+ [ %.name ] ] Clear this list
  32. }
  33. _timersinc if ($1 < 1) return | if ($3 == $null) set -u $+ [ $1 ] % $+ [ $2 ] $calc( [ % $+ [ $2 ] ] + 1) | else set -u $+ [ $1 ] % $+ [ $2 ] $calc( [ % $+ [ $2 ] ] + $3)
  34. _progress.1 {
  35.   window -c @Progress
  36.   window -ardo +fn @Progress $_center(527,100,d) 527 100 @Close2 Arial 18
  37.   titlebar @Progress Meter- 0%
  38.   aline %col.cust @Progress  $+ $1-
  39.   aline %col.cust @Progress  $+ ...
  40.   aline @Progress 15,15 $+ $str(á,100)
  41.   set %.pr.bk $_i($colour(back))
  42.   set %_pr.dk $gettok(1.0.0.0.0.0.0.0.1.1.0.1.0.1.0.1,%.pr.bk,46)
  43.   set %_pr.lt $gettok(15.14.12.10.7.4.13.4.7.3.15.10.10.6.15.14,%.pr.bk,46)
  44.   set %_pr.dk  $+ %_pr.dk $+ , $+ %_pr.dk $+ 
  45.   set %_pr.lt  $+ %_pr.lt $+ , $+ %_pr.lt
  46. }
  47. _progress.2 if ($2 != $null) rline %col.cust @Progress 2  $+ $2- | rline @Progress 3 %_pr.dk $+ $str(á,$1) $+ %_pr.lt $+ $str(á,$calc(100 - $1)) | titlebar @Progress Meter- $1 $+ %
  48. dispc if ($left($active,1) == @) disprsc - $1- | else { set %_last.disp $1- | if (%+time.stamp) echo %col.base %event.route $timestamp %@c $1- | else echo %col.base %event.route %@c $1- }
  49. disp if (($left($active,1) == @) && ($active != @Info)) disps $1- | else { set %_last.disp $1- | if (%+time.stamp) echo %col.base %event.route $timestamp %@ $1- | else echo %col.base %event.route %@ $1- }
  50. dispa if (($left($active,1) == @) && ($active != @Info)) disps $1- | else { set %_last.disp $1- | if (%+time.stamp) echo %col.base -ai2 $timestamp %@ $1- | else echo %col.base -ai2 %@ $1- }
  51. disps set %_last.disp $1- | if (%+time.stamp) echo %col.base -si2 $timestamp %@ $1- | else echo %col.base -si2 %@ $1-
  52. disprsc {
  53.   set %_last.disp $2-
  54.   if (%+time.stamp) { if ($_isopen($1)) echo %col.base -i2 $1 $timestamp %@c $2- | else echo %col.base -si2 $timestamp %@c $2- }
  55.   else { if ($_isopen($1)) echo %col.base -i2 $1 %@c $2- | else echo %col.base -si2 %@c $2- }
  56. }
  57. dispr {
  58.   if ($1 == -si2) disps $2-
  59.   elseif ($1 == -ai2) dispa $2-
  60.   elseif ($_isopen($1)) { set %_last.disp $2- | if (%+time.stamp) echo %col.base -i2 $1 $timestamp %@ $2- | else echo %col.base -i2 $1 %@ $2- }
  61.   else disp $2-
  62. }
  63. disprs {
  64.   if ($1 == -si2) disps $2-
  65.   elseif ($1 == -ai2) dispa $2-
  66.   else {
  67.     set %_last.disp $2-
  68.     if (%+time.stamp) { if ($_isopen($1)) echo %col.base -i2 $1 $timestamp %@ $2- | else echo %col.base -si2 $timestamp %@ $2- }
  69.     else { if ($_isopen($1)) echo %col.base -i2 $1 %@ $2- | else echo %col.base -si2 %@ $2- }
  70.   }
  71. }
  72. disp-div if (($left($active,1) == @) && ($active != @Info)) disps-div | elseif (%event.route == -ai2) dispa-div | else disps-div
  73. dispa-div {
  74.   if (($left($active,1) == @) && ($active != @Info)) disps-div
  75.   else {
  76.     if (%= !isin $line($active,$line($active,0))) {
  77.       if (%+time.stamp) echo %col.base -a $timestamp %@ %=
  78.       else echo %col.base -a %@ %=
  79.     }
  80.   }
  81. }
  82. disps-div {
  83.   if (%= !isin $line(Status Window,$line(Status Window,0))) {
  84.     if (%+time.stamp) echo %col.base -s $timestamp %@ %=
  85.     else echo %col.base -s %@ %=
  86.   }
  87. }
  88. dispr-div {
  89.   if ($left($1,2) == -s) disps-div
  90.   elseif ($left($1,2) == -a) dispa-div
  91.   elseif ($_isopen($1)) {
  92.     if (%= !isin $line($1,$line($1,0))) {
  93.       if (%+time.stamp) echo %col.base $1 $timestamp %@ %=
  94.       else echo %col.base $1 %@ %=
  95.     }
  96.   }
  97.   else disp-div
  98. }
  99. disprs-div if ($_isopen($1)) dispr-div $1 | else disps-div
  100. open {
  101.   if (%+desktopping) { set %.spec1 d | set %.spec2 -d } | else unset %.spec?
  102.   if (@Ping isin $1-) {
  103.     set %.op.switch -el $+ %.spec1
  104.     if (%+ping.minimized) set %.op.switch %.op.switch $+ n
  105.     if (%+ping.sorted) set %.op.switch %.op.switch $+ s
  106.     window %.op.switch @Ping %pp.ping /ping @Ping %font.basic
  107.     titlebar @Ping Basket
  108.   }
  109.   elseif (@Whois isin $1-) {
  110.     if (%+whois.minimized) window -en $+ %.spec1 @Whois %pp.whois /whois @Whois %font.basic
  111.     else window -e $+ %.spec1 @Whois %pp.whois /whois @Whois %font.basic
  112.     titlebar @Whois Tome
  113.     set %.ow.file $_ppdir $+ who-temp.txt
  114.     if ((%+whois.retain) && ($exists(%.ow.file))) loadbuf @Whois %.ow.file
  115.   }
  116.   elseif (@Server isin $1-) {
  117.     if (%+snotice.minimized) window -n $+ %.spec1 @ServeráNotices $_winpos(14%,7%,8%,8%) @Close %font.basic
  118.     else window %.spec2 @ServeráNotices $_winpos(14%,7%,8%,8%) @Close %font.basic
  119.   }
  120.   elseif (@Wallop isin $1-) {
  121.     if (%+wallop.minimized) window -n $+ %.spec1 @Wallops $_winpos(14%,7%,8%,8%) @Close %font.basic
  122.     else window %.spec2 @Wallops $_winpos(14%,7%,8%,8%) @Close %font.basic
  123.   }
  124.   elseif (@Leech isin $1-) {
  125.     window -n $+ %.spec1 @Leech $_winpos(14%,7%,8%,8%) @Close %font.basic
  126.     unset %_leech.sent %_leech.ignored %_leech.invalid
  127.   }
  128.   elseif (@Pager isin $1-) window -adlo -t2 @Pager $_center(600,400,d) 600 400 @Pager %font.basic
  129.   elseif (@Roulette isin $1-) { unset %_+roulcolor | window -nl $+ %.spec1 @Roulette $_winpos(20,20,20,20) @Roulette %font.basic }
  130.   elseif (@Message isin $1-) window -al  $+ %.spec1 @Message $_winpos(10,10,10,10) @Close %font.basic
  131.   elseif (@Info isin $1-) {
  132.     if ($_isopen(@Info)) dispr @Info %=
  133.     window -are  $+ %.spec1 @Info $_winpos(14%,7%,8%,8%) $2 @Close %font.basic
  134.     titlebar @Info - $3-
  135.   }
  136. }
  137. _spec1d if (%+desktopping) return d | return
  138. _ping set %_pnx 0 | set %_pny 0 | set %_pnxi 25 | set %_pnyi 25
  139. _pong window -rdol +b @PingPong %_pnx %_pny 100 100 /_pung | inc %_pnx %_pnxi | if (($calc(%_pnx + 125) >= $window(-1).w) || (%_pnx < 25)) set %_pnxi $calc(0 - %_pnxi) | inc %_pny %_pnyi | if (($calc(%_pny + 125) >= $window(-1).h) || (%_pny < 25)) set %_pnyi $calc(0 - %_pnyi)
  140. _pung window -c @PingPong | .timerpingpong off
  141. _peng if ($window(@PingPong) == $null) _pung | else _pong
  142. _pang _ping | _pong | .timerpingpong -m 0 25 _peng
  143. _alert _title $1 | flash $_p2s($1) | echo 4 -ai2 %col.alert %col.dark $+ %! $+  $+ %col.alert $2-  $+ %col.alert $+ %col.dark $+ %!  | if ((%+accept.ebeeps.away) || (%_away.why == $null)) beep 1 1
  144. _needops _error You need ops or a supported bot (X/W/ChanServ or custom botlist) on  $+ $1 $+  in order to $2-
  145. _needops2 _error You need ops on  $+ $1 $+  in order to $2-
  146. _needops3 _error You need ops or authentication on a bot (X/W) on  $+ $1 $+  in order to $2-
  147. _title {
  148.   if ($1 == $null) { unset %_title.bar | _updtitle }
  149.   else { set %_title.bar $_p2s($1-) - | _updtitle | .timer901 -o 1 16 _title }
  150. }
  151. _updtitle {
  152.   if ($group(#_fkeysound) == on) return
  153.   if (%show.title == nickname) set %.ut.1 $me | else set %.ut.1 %pp.net
  154.   if ((%-collect.avg1 != $null) && (%-collect.target != $null)) titlebar %_title.bar %.ut.1 $_avglag - SelfLag: %self.lag - P&P
  155.   else {
  156.     if (%_away.title != $null) set %.ut.2 %_away.title $chr(160) Log: $+ $upper($_tf2o(%+awaylog.on))
  157.     elseif ($chan($active) == $active) set %.ut.2 [[ $+ $nick($active,0) @ $+ $opnick($active,0) + $+ $vnick($active,0) ñ $+ $calc($nvnick($active,0) - $opnick($active,0)) $+ ]]
  158.     elseif (($query($active) == $active) || ($chat($remove($active,=)) == $remove($active,=))) {
  159.       set %.ut.num $comchan($remove($active,=),0)
  160.       if (%.ut.num == 0) set %.ut.2 [no common channels]
  161.       else {
  162.         unset %.ut.2
  163.         :loop | if ($remove($active,=) isop $comchan($remove($active,=),%.ut.num)) set %.ut.2 %.ut.2 @ $+ $comchan($remove($active,=),%.ut.num) | elseif ($remove($active,=) isvo $comchan($remove($active,=),%.ut.num)) set %.ut.2 %.ut.2 + $+ $comchan($remove($active,=),%.ut.num) | else set %.ut.2 %.ut.2 $comchan($remove($active,=),%.ut.num)
  164.         if (%.ut.num > 1) { dec %.ut.num | goto loop }
  165.         set %.ut.2 [[ $+ %.ut.2 $+ ]]
  166.       }
  167.     }
  168.     elseif ($server == $null) set %.ut.2 Offline
  169.     else set %.ut.2 $server $+ [[ $+ $port $+ ]]
  170.     if (%+idle.meter) titlebar %_title.bar %.ut.1 $_avglag - SelfLag: %self.lag á--á %.ut.2 $chr(160) Pager: $+ $upper($_tf2o(%+pager)) $chr(160) $chr(160) [idle $duration($idle) $+ ]] - P&P 
  171.     else titlebar %_title.bar %.ut.1 $_avglag - SelfLag: %self.lag á--á %.ut.2 $chr(160) Pager: $+ $upper($_tf2o(%+pager)) - P&P
  172.   }
  173. }
  174. _qc .raw PRIVMSG $1 : $+ $2- $+ 
  175. _qcr .raw NOTICE $1 : $+ $2- $+ 
  176. _privmsg .raw PRIVMSG $1 : $+ $2-
  177. _qnotice .raw NOTICE $1 : $+ $2-
  178. _tnotice _qnotice $1- | echo $colour(notice) -si2 -> - $+ $1 $+ - $2-
  179. _psplit {
  180.   if ($_ischan($2)) {
  181.     if (($1 != mm) && ($1 != tt) && ($chan($replace($2,,+)) == $null)) { _error You must be on the specified channel in order to use this command. | halt }
  182.     set %. [ $+ [ $1 [ $+ [ .chan ] ] ] ] $replace($2,,+) | set %. [ $+ [ $1 [ $+ [ .nick ] ] ] ] $3 | set %. [ $+ [ $1 [ $+ [ .msg ] ] ] ] $4- | set %. [ $+ [ $1 [ $+ [ .param ] ] ] ] $3-
  183.   }
  184.   else {
  185.     if ($chan($active) != $active) { _error You must use this in a channel or specify a target channel. | halt }
  186.     set %. [ $+ [ $1 [ $+ [ .chan ] ] ] ] $active | set %. [ $+ [ $1 [ $+ [ .nick ] ] ] ] $2 | set %. [ $+ [ $1 [ $+ [ .msg ] ] ] ] $3- | set %. [ $+ [ $1 [ $+ [ .param ] ] ] ] $2-
  187.   }
  188. }
  189. _writecfg if ($3 == $null) _remcfg $1- | else writeini $_ppdir $+ config.ini $1-
  190. _remcfg remini $_ppdir $+ config.ini $1-
  191. _writeblk writeini $_ppdir $+ black.ini Blacklist $1-
  192. _remblk remini $_ppdir $+ black.ini Blacklist $1
  193. _writeseen if ($3 == $null) _remseen $1- | else writeini $_ppdir $+ lastseen.ini $1-
  194. _remseen remini $_ppdir $+ lastseen.ini $1-
  195. remini if ($3 == $null) remini $1- | else remini $1- $_iniprep($3)
  196. writeini {
  197.   if (" isin $1) writeini " $+ $gettok($1-,1,34) $+ " $gettok($gettok($1-,2-,34),1,32) $_iniprep($gettok($gettok($1-,2-,34),2,32)) $_writeprep($gettok($gettok($1-,2-,34),3-,32))
  198.   else writeini $1-2 $_iniprep($3) $_writeprep($4-)
  199. }
  200. timers {
  201.   if (($1 == off) && ($timer(0) > 0)) {
  202.     set %.loop $timer(0)
  203.     :loop
  204.     if ($timer(%.loop) !isnum 900-999) timer [ $+ [ $timer(%.loop) ] ] off
  205.     if (%.loop > 1) { dec %.loop | goto loop }
  206.   }
  207.   else timers $1-
  208. }
  209. ; -----------------------------------------------------
  210. ; Possibly not belong here in
  211. ; "standard aliases"
  212. ; -----------------------------------------------------
  213. _botcmd {
  214.   set %.bot1st2 $gettok(%.botlistcmd,1,32)
  215.   set %.bot1st $remove($remove(%.bot1st2,/),.)
  216.   if ((%.bot1st == privmsg) || (%.bot1st == msg)) set %.bot1st _privmsg
  217.   elseif ((%.bot1st == notice) || (%.bot1st == n)) set %.bot1st _qnotice
  218.   elseif (%.bot1st == ctcp) set %.bot1st _qc
  219.   elseif (%.bot1st == ctcpreply) set %.bot1st _qcr
  220.   elseif (%.bot1st == say) set %.bot1st msg $2
  221.   elseif ((%.bot1st == me) || (%.bot1st == action)) set %.bot1st describe $2
  222.   elseif (/ !isin %.bot1st2) set %.bot1st _privmsg $1 %.bot1st2
  223.   if (&pw& isin %.botlistcmd) set %.botlistcmd $replace(%.botlistcmd,&pw&,$_pwenc($_ppcfg(%.botlistvar,pw)))
  224.   if ($4 == $null) set %.botlistcmd $remove(%.botlistcmd,&msg&)
  225.   else set %.botlistcmd $replace(%.botlistcmd,&msg&,$4-)
  226.   %.bot1st $replace($replace($replace($replace($gettok(%.botlistcmd,2-,32),&chan&,$2),&nick&,$3),&bot&,$1),&me&,$me)
  227. }
  228. _usebot {
  229.   set %.use.n %autobot. [ $+ [ $1 ] ]
  230.   set %.use.n $gettok(%.use.n,1,32)
  231.   if (%.use.n < 1) return
  232.   set %.use.c 1
  233.   :loop1
  234.   set %.botlistvar autobot. $+ $1 $+ . $+ %.use.c
  235.   set %.botlistcmd $_ppcfg(%.botlistvar,$2)
  236.   if (%.botlistcmd == $null) {
  237.     if ($2 == opme) set %.botlistcmd $_ppcfg(%.botlistvar,op)
  238.     if (%.botlistcmd == $null) goto next
  239.   }
  240.   set %.use.m % [ $+ [ %.botlistvar ] ]
  241.   set %.use.t $gettok(%.use.m,2-,47)
  242.   set %.use.s $gettok($gettok(%.use.m,2-,36),1,47)
  243.   set %.use.m $gettok($gettok(%.use.m,1,47),1,36)
  244.   if ((%.use.s != $null) && (%.use.s != %pp.net) && (%.use.s !iswm $server)) goto next
  245.   if (%.use.t == service) return %.use.m
  246.   set %.use.x $ialchan(%.use.m,$1,0)
  247.   if (%.use.x == 0) goto next
  248.   :loop2
  249.   set %.use.w $ialchan(%.use.m,$1,%.use.x).nick
  250.   if (%.use.w isop $1) return %.use.w
  251.   if ($_vd(.use.x) > 0) goto loop2
  252.   :next
  253.   if ($_vi(.use.c) <= %.use.n) goto loop1
  254.   return
  255. }
  256. _usexw {
  257.   if ($3 == $null) unset %.use.bot | else set %.use.bot $_usebot($1,$3)
  258.   if ((%.+usebot) && (%.use.bot != $null)) { set %.xw %.use.bot | unset %.+usebot | return }
  259.   unset %.+usebot
  260.   if (%.+usexw) {
  261.     if (%s^c == ChanServ) { set %.xw ChanServ | goto okay }
  262.     if ($_isxw($1) != $null) goto okay
  263.   }
  264.   unset %.+usexw
  265.   if ($me isop $1) { if ((%xw.use == Always) && ($_isxw($1) != $null)) goto usexw | unset %.xw }
  266.   else {
  267.     if (%xw.use == Never) { if (%.use.bot != $null) { set %.xw %.use.bot | return } | _needops2 $1 $_p2s($2) }
  268.     if (%s^c == ChanServ) { set %.xw ChanServ | goto okay }
  269.     if ($_isxw($1) == $null) { if (%.use.bot != $null) { set %.xw %.use.bot | return } | _needops $1 $_p2s($2) }
  270.     :usexw
  271.     if ((%+xw.must.login) && (%-authxw. [ $+ [ $1 ] ] == $null)) { if (%.use.bot != $null) { set %.xw %.use.bot | return } | _needops3 $1 $_p2s($2) }
  272.     if ((%.use.bot != $null) && (%-authxw. [ $+ [ $1 ] ] == $null)) set %.xw %.use.bot
  273.   }
  274.   :okay
  275.   unset %.+usexw
  276. }
  277. _msgxw {
  278.   if ($1 isin XW) {
  279.     set %.xw.msg $_xwtarg($1)
  280.     set %.xw $1
  281.   }
  282.   else _isxw $1 V
  283.   _privmsg %.xw.msg $2-
  284.   if (($2 == login) || ($2 == newpass)) dispa Using %col.target $+ %.xw $+  for command: %col.info1 $+ $2-3 ?????
  285.   else dispa Using %col.target $+ %.xw $+  for command: %col.info1 $+ $2-
  286. }
  287. _msgcs {
  288.   cs $1-
  289.   if (($1 == register) || ($1 == identify)) dispa Using %col.target $+ ChanServ for command: %col.info1 $+ $1-2 ????? $3-
  290.   elseif (($1 == set) && ($3 == passwd)) dispa Using %col.target $+ ChanServ for command: %col.info1 $+ $1-3 ?????
  291.   else dispa Using %col.target $+ ChanServ for command: %col.info1 $+ $1-
  292. }
  293. _msgns {
  294.   ns $1-
  295.   if (($1 == register) || ($1 == identify)) dispa Using %col.target $+ NickServ for command: %col.info $+ $1 ?????
  296.   elseif (($1 == ghost) || ($1 == recover) || ($1 == release)) dispa Using %col.target $+ NickServ for command: %col.info $+ $1-2 ?????
  297.   elseif (($1 == set) && ($2 == passwd)) dispa Using %col.target $+ NickServ for command: %col.info $+ $1-2 ?????
  298.   else dispa Using %col.target $+ NickServ for command: %col.info $+ $1-
  299. }
  300. _msgms {
  301.   ms $1-
  302.   if (($1 == forward) && ($2 != -) && ($2 != $null)) dispa Using %col.target $+ MemoServ for command: %col.info $+ $1-2 ?????
  303.   else dispa Using %col.target $+ MemoServ for command: %col.info $+ $1-
  304. }
  305. _quickhelp {
  306.   window -c @Quick
  307.   window -ardoe +fn @Quick $_center(527,115,d) 527 115 $1 @Close %font.quick
  308.   titlebar @Quick Help- $1
  309.   aline %col.cust @Quick Please type in valid parameters for  $+ $1 $+ 
  310.   set %.qh.help $_ppqhelp($1)
  311.   if ([ isin %.qh.help) aline %col.cust @Quick [param] = optional parameter;á param = required parameter
  312.   else aline %col.cust @Quick param = required parameter
  313.   aline %col.cdark @Quick  $+ $1 $replace($replace($replace($replace(%.qh.help,[,[),],]),_,),$chr(32),$str($chr(160),2))
  314.   .timer913 -om 0 100 _chkquik
  315.   halt
  316. }
  317. _error window -c @Error | .timer 1 0 _errerr $1- | halt
  318. _errerr {
  319.   window -ardo +fn @Error $_center(527,100,d) 527 100 @Close2 %font.quick
  320.   aline %col.cust @Error Error-
  321.   echo $remove(%col.cdark,-c) @Error  $+ $1-
  322.   .timer911 -om 0 100 _chkerr
  323.   halt
  324. }
  325. _chkquik if (($window(@Quick).state != normal) || ($active != @Quick)) { window -c @Quick | .timer913 off }
  326. _chkerr if (($window(@Error).state != normal) || ($active != @Error)) { window -c @Error | .timer911 off }
  327. ; $_countfiles(*.mp2;*.mp3,f:\mp3\;g:\;c:\download\incoming\)
  328. ; if %.cf.win != $null, sends output to window
  329. _countfiles {
  330.   if (%.cf.win == $null) set %.cf.win 0
  331.   set %.cf.num $_numtok(59,$2-)
  332.   set %.cf.total 0
  333.   set %.cf.var 1
  334.   :loop1
  335.   set %.cf.num2 $_numtok(59,$1)
  336.   :loop2
  337.   set %.cf. [ $+ [ %.cf.var ] ] $findfile($gettok($2-,%.cf.num,59),$gettok($1,%.cf.num2,59),%.cf.win)
  338.   set %.cfd. [ $+ [ %.cf.var ] ] $gettok($2-,%.cf.num,59)
  339.   set %.cfm. [ $+ [ %.cf.var ] ] $gettok($1,%.cf.num2,59)
  340.   inc %.cf.total %.cf. [ $+ [ %.cf.var ] ]
  341.   inc %.cf.var
  342.   if ($_vd(.cf.num2) > 0) goto loop2
  343.   if ($_vd(.cf.num) > 0) goto loop1
  344.   unset %.cf.win
  345.   return %.cf.total
  346. }
  347. ; $_randfile(*.mp2;*.mp3,f:\mp3\;g:\;c:\download\incoming\)
  348. ; if %.cf.win != $null, closes window if finds one else returns @ and leaves open
  349. _randfile {
  350.   if (%.cf.win != $null) set %.rf.win %.cf.win
  351.   set %.cf.max $_countfiles($1-)
  352.   if (%.cf.max == 0) return
  353.   if (%.rf.win != $null) {
  354.     if ((%.cf.max > 1) || (%.+cf.keep)) { unset %.rf.win %.+cf.keep | return @ }
  355.     set %.rf.ret2 $line(%.rf.win,1) | window -c %.rf.win | unset %.rf.win | return %.rf.ret2
  356.   }
  357.   return $_pickfile($calc(($ticks + $r(1,%.cf.max)) % %.cf.max + 1),$1-)
  358. }
  359. ; $_pickfile(5,*.mp2;*.mp3,f:\mp3\;g:\;c:\download\incoming\)
  360. _pickfile {
  361.   set %.cf.rand $1
  362.   set %.cf.sec 1
  363.   :loop
  364.   if (%.cf.rand > %.cf. [ $+ [ %.cf.sec ] ] ) {
  365.     dec %.cf.rand %.cf. [ $+ [ %.cf.sec ] ]
  366.     inc %.cf.sec
  367.     goto loop
  368.   }
  369.   set %.cfd %.cfd. [ $+ [ %.cf.sec ] ] 
  370.   set %.cfm %.cfm. [ $+ [ %.cf.sec ] ]
  371.   return $findfile(%.cfd,%.cfm,%.cf.rand)
  372. }
  373. _massmode {
  374.   set %.mm.mode $left($2,1) $+ $str($right($2,1),%_max.mode)
  375.   set %.mm.nicks $3-
  376.   :loop
  377.   set %.mm.target $gettok(%.mm.nicks, [ 1- [ $+ [ %_max.mode ] ] ] ,32)
  378.   if (%.mm.target != $null) {
  379.     set %.mm.origt %.mm.target
  380.     if (b !isin $2) set %.mm.target $_nickcseries(32,$1,%.mm.target)
  381.     .raw mode $1 $left(%.mm.mode,$calc(2 + $count(%.mm.target,$chr(32)))) %.mm.target
  382.     set %.mm.nicks $remove(%.mm.nicks,%.mm.origt)
  383.     goto loop
  384.   }
  385. }
  386. _selfstop if (%pp.net == offline) return | _timersinc 5 -selfstop. $+ $1 | if (%-selfstop. [ $+ [ $1 ] ] > $2) { dispa $1 aborted to avoid flooding. | halt }
  387. ; single param entry
  388. _pentry .timer -om 1 1 _pentry2 $1- | halt
  389. _pentry2 _timer924off | window -c @Peace | .timer -om 1 1 _pentry3 $1- | halt
  390. _pentry3 {
  391.   window -c @Peace
  392.   window -arde +fn @Peace $_center(527,115,d) 527 115 @Close2 %font.quick
  393.   titlebar @Peace and Protection - Parameter Entry á (ESC to cancel)
  394.   set %.pe.q $2-
  395.   if ( !isin %.pe.q) set %.pe.q %.pe.q $+ ( $+ %col.custdark $+ ESC to %col.custdark $+ cancel.)
  396.   else {
  397.     set %.pe.opt1 ( $+ %col.custdark $+ Enter for %col.custdark $+ Default, %col.custdark $+ ESC to %col.custdark $+ Cancel)
  398.     set %.pe.opt2 ( $+ %col.custdark $+ Enter for %col.custdark $+ none, %col.custdark $+ ESC to %col.custdark $+ Cancel)
  399.     set %.pe.q $replace($replace(%.pe.q,1,%.pe.opt1),2,%.pe.opt2)
  400.   }
  401.   set %.pe.max $_numtok(127,%.pe.q)
  402.   set %.pe.num 1
  403.   :loop
  404.   echo $remove(%col.cust,-c) @Peace  $+ $gettok(%.pe.q,%.pe.num,127)
  405.   if ($_vi(.pe.num) <= %.pe.max) goto loop
  406.   set %_+pe.req $false
  407.   if ($right($1,1) == ) { editbox @Peace $chr(160) | set %_+pe.req $true }
  408.   elseif ( isin $1) editbox @Peace $_p2s($gettok($1,2-,127))
  409.   else editbox @Peace $chr(160)
  410.   set %_pe.command $gettok($1,1,127)
  411.   .timer927 -om 0 100 _chkentry
  412.   halt
  413. }
  414. _chkentry if (($window(@Peace).state != normal) || ($active != @Peace)) { window -c @Peace | .timer927 off | _timer924on }
  415. _askr _pentry $1 $+  $2- $+ ( $+ %col.custdark $+ ESC or %col.custdark $+ Enter to %col.custdark $+ Cancel)
  416. _askyn _pentry $1 $2- $+ ( $+ %col.custdark $+ Enter for %col.custdark $+ OK, %col.custdark $+ ESC to %col.custdark $+ Cancel)
  417. _arhelp %_arhelp $1- | unset %_arhelp
  418. ; Automated userhost lookup
  419. ; _lookup Nick # command left , command right
  420. ; # = ppmask type, ! = fulladdress
  421. _lookup {
  422.   if ($right(%-uhsearch,6) == .clean) {
  423.     if ($show) dispa Looking up address of %col.target $+ $1 $+ ...
  424.     .timer 1 4 ._lookup $1-
  425.     halt
  426.   }
  427.   set %-userhostc1. [ $+ [ $1 ] ] $3-
  428.   set %-userhostc2. [ $+ [ $1 ] ] $2
  429.   set %-uhsearch %-uhsearch $1
  430.   .userhost $1
  431.   if ($show) dispa Looking up address of %col.target $+ $1 $+ ...
  432.   halt
  433. }
  434. _nickcol {
  435.   if ($2 == %-my.address) _updncol $1 %col.nickm
  436.   elseif ((* isin $4) && (%+ircop.check)) _updncol $1 %col.nicki
  437.   else {
  438.     if ($level($3) > 1) {
  439.       writeini $_ppdir $+ userlist.ini seen $maddress($3) $ctime Saw
  440.       if ($null == $readini $_ppdir $+ userlist.ini nick $maddress($3)) writeini $_ppdir $+ userlist.ini nick $maddress($3) $1
  441.     }
  442.     if (black isin $level($3)) _updncol $1 %col.nickb
  443.     elseif (color isin $level($3)) _updncol $1 $gettok($_rchop($calc($pos($level($3),color) + 4),$level($3)),1,44)
  444.     elseif ($1 isnotify) {
  445.       if (%-+notifymatch. [ $+ [ $1 ] ] == $false) _updncol $1 %col.nickf
  446.       else _updncol $1 %col.nicko
  447.     }
  448.     elseif ($level($3) > 1) _updncol $1 %col.nicks
  449.     else _updncol $1
  450.   }
  451.   else _updncol $1
  452. }
  453. _updncol {
  454.   set %-nickcol. [ $+ [ $1 ] ] $2-
  455.   set %.uc.nch $comchan($1,0)
  456.   if (%.uc.nch == 0) return
  457.   :do
  458.   cline $iif($remove($2,),$remove($2,),$colour(listbox text)) $comchan($1,%.uc.nch) $1
  459.   if ($_vd(.uc.nch) > 0) goto do
  460. }
  461. _updchcol {
  462.   set %.uc.nch $nick($1,0)
  463.   :do
  464.   set %.uc.nick $nick($1,%.uc.nch)
  465.   if ($remove($gettok(%-nickcol. [ $+ [ %.uc.nick ] ] ,1,32),)) cline $ifmatch $1 %.uc.nick | else cline $colour(listbox text) $1 %.uc.nick
  466.   if ($_vd(.uc.nch) > 0) goto do
  467. }
  468. _vresync {
  469.   .raw names %-vsync.2update
  470.   set %-vsync.update %-vsync.update %-vsync.2update
  471.   set %-vsync.update $_s2c(%-vsync.update)
  472.   unset %-vsync.2update
  473.   .enable #-voicesync  
  474. }
  475. _ctcpmsg {
  476.   set %.gm.ret $_getmsg(CTCP,$1)
  477.   if (%.gm.ret == $null) return
  478.   set %.gm.ret $replace($replace($replace($replace($replace(%.gm.ret,&mircver&,$version),&idle&,$duration($idle)),&date&,$date),&day&,$day),&time&,$time)
  479.   if (%pp.addon != $null) return $_finalmsg($replace(%.gm.ret,&addons&,%pp.addon))
  480.   return $_finalmsg($remove(%.gm.ret,&addons&))
  481. }
  482. _dragdrop {
  483.   set %.ext $remove($_mapext($_rtok(1,46,$3-)),")
  484.   if ((%.ext == mp2) || (%.ext == mp3)) set %.ext mp
  485.   if (((%+accept. [ $+ [ %.ext ] ] == $null) && ($findtok(%soundfile.custom,%.ext,32) == $null)) || ($1 == s)) {
  486.     if ($chan($2) == $2) {
  487.       ff -afn $3-
  488.       .timer931 1 1 window -ar @Express
  489.     }
  490.     else dcc send $2-
  491.   }
  492.   else {
  493.     if ($1 == r) unset %.dd.win
  494.     else {
  495.       set %.dd.win = $+ $2
  496.       if ($_isopen(%.dd.win) == $false) set %.dd.win $2
  497.     }
  498.     set %.desc %+desc. [ $+ [ %.ext ] ]
  499.     set %.play %soundact. [ $+ [ %.ext ] ]
  500.     if (%.play == $null) set %.play plays
  501.     sound %.dd.win $remove($replace($3-,$chr(32),?),") $_soundmsg(%.play,%.desc,$remove($3-,"))
  502.   }
  503. }
  504. ; Call- _prog.punish caps CapsFlood 10 50 #channel Nick Nick site234.domain.com (type, kickname, &num&, &secs&, chan, tokick, nick, site)
  505. ; Will deal out progressive punishment to any number of levels using action# vars and adding a # to kickmessage above first
  506. _prog.punish {
  507.   if (($1 == ptext) || ($1 == scroll)) if (%floodignore.maxlag > 1) if ((%-lastselflag >= %floodignore.maxlag) || ($remove(%self.lag,+sec) >= %floodignore.maxlag)) return
  508.   set %.mc.wait -+waits. $+ $8 $+ $5
  509.   if (% [ $+ [ %.mc.wait ] ] ) return
  510.   set %.mc.once -once. $+ $1 $+ . $+ $8 $+ $5
  511.   set %.mc.reps % [ $+ [ %.mc.once ] ]
  512.   inc %.mc.reps
  513.   set %.mc.acti action $+ %.mc.reps $+ . $+ $1
  514.   if (%.mc.reps > 1) set %.mc.kickm $2 $+ %.mc.reps
  515.   else set %.mc.kickm $2
  516.   if (($6 ison $5) || ($_ismask($6))) {
  517.     set %.mc.cmd $_setting(%.mc.acti,$5)
  518.     if (op isin %.mc.cmd) %.mc.cmd $5 $6
  519.     else %.mc.cmd $5 $6 $_kickmsg($5,$7,%.mc.kickm,$3,$4)
  520.   }
  521.   _timersinc $_setting(delay.second.active,$5) %.mc.wait
  522.   set %.mc.acti action $+ $_i(%.mc.reps) $+ . $+ $1
  523.   set %.mc.acti1 action1. $+ $1 $+ . $+ $5
  524.   if (% [ $+ [ %.mc.acti1 ] ] != $null) set %.mc.acti %.mc.acti $+ . $+ $5
  525.   if (% [ $+ [ %.mc.acti ] ] != $null) _timersinc $calc($_setting(delay.second.active,$5) + $_setting(delay.second.clear,$5)) %.mc.once
  526.   return %.mc.cmd
  527. }
  528. _setfld {
  529.   set %delay.ping $1 | set %max.ping $2 | set %halt.ping $3
  530.   set %delay.ver $4 | set %max.ver $5 | set %halt.ver $6
  531.   set %delay.misc $7 | set %max.misc $8 | set %halt.misc $9
  532.   set %delay.unknown $10 | set %max.unknown $11 | set %halt.unknown $12
  533.   set %delay.echo $13 | set %max.echo $14 | set %halt.echo $15
  534.   set %delay.flood $16 | set %max.flood $17
  535.   set %delay.ctcp $18 | set %max.ctcp $19 | set %halt.ctcp $20
  536.   set %delay.bytes $21 | set %max.bytes $22 | set %halt.bytes $23
  537.   .flood $24 | .flood $25-28 | set %pp.flood $25-28
  538. }
  539. _setcfld set %delay.chan.flood.ctcp. [ $+ [ # ] ] $1 | set %delay.chan.bytes.ctcp. [ $+ [ # ] ] $2 | set %max.chan.flood.ctcp. [ $+ [ # ] ] $3 | set %max.chan.bytes.ctcp. [ $+ [ # ] ] $4
  540. _repUaddr {
  541.   writeini $_ppdir $+ userlist.ini seen $1 $readini $_ppdir $+ userlist.ini seen $2
  542.   writeini $_ppdir $+ userlist.ini nick $1 $readini $_ppdir $+ userlist.ini nick $2
  543.   .auser $3 $1 | .ruser $2
  544.   remini $_ppdir $+ userlist.ini seen $2
  545.   remini $_ppdir $+ userlist.ini nick $2
  546.   _ULaline $1 $4
  547. }
  548. _doUsel {
  549.   if ($sline(@Userlist,1).ln < 5) halt
  550.   set %.p2 $2
  551.   :loop
  552.   set %.line $strip($sline(@Userlist,1))
  553.   if (%.line == $null) halt
  554.   set %.addr $gettok(%.line,2,9)
  555.   set %.ln $sline(@Userlist,1).ln
  556.   set %.lvl $level(%.addr)
  557.   if ($1 == k) {
  558.     .ruser %.addr
  559.     remini $_ppdir $+ userlist.ini seen %.addr
  560.     remini $_ppdir $+ userlist.ini nick %.addr
  561.     dline @Userlist %.ln
  562.   }
  563.   elseif ($1 == d) _repUaddr $_ppmask(%.addr,4) %.addr %.lvl %.ln
  564.   elseif ($1 == i) _repUaddr $gettok($_ppmask(%.addr,3),1,64) $+ @* %.addr %.lvl %.ln
  565.   elseif ($1 == m) {
  566.     if (%.p2 == $null) { set %_arhelp _doUsel m | _pentry _arhelp $+ %.addr New mask for %col.custdark $+ %.addr $+ ? }
  567.     _repUaddr %.p2 %.addr %.lvl %.ln
  568.     unset %.p2
  569.   }
  570.   elseif ($1 == n) {
  571.     if ($2 == !) {
  572.       if ($ial(%.addr,0) > 0) writeini $_ppdir $+ userlist.ini nick %.addr $ial(%.addr,1).nick
  573.     }
  574.     else {
  575.       if (%.p2 == $null) {
  576.         set %_arhelp _doUsel n
  577.         if ($ial(%.addr,0) > 0) _pentry _arhelp $+ $ial(%.addr,1).nick New nickname for %col.custdark $+ %.addr $+ ?
  578.         elseif ($chr(40) isin $gettok(%.line,1,9)) _pentry _arhelp New nickname for %col.custdark $+ %.addr $+ ?
  579.         else _pentry _arhelp $+ $gettok(%.line,1,9) New nickname for %col.custdark $+ %.addr $+ ?
  580.       }
  581.       writeini $_ppdir $+ userlist.ini nick %.addr $gettok(%.p2,1,32)
  582.     }
  583.     _ULaline %.addr %.ln
  584.     unset %.p2
  585.   }
  586.   elseif ($1 isin -+) {
  587.     userlevel %.addr $1 $+ $2 -q $3
  588.     _ULaline %.addr %.ln
  589.   }
  590.   elseif ($1 == c) {
  591.     if (color isin %.lvl) userlevel %.addr - $+ $gettok($_rchop($_j($pos(%.lvl,color)),%.lvl),1,44) -q
  592.     if ($2 != $null) userlevel %.addr +color $+ $2 -q
  593.     _ULaline %.addr %.ln
  594.   }
  595.   else halt
  596.   goto loop
  597. }
  598. _Ubulksel {
  599.   if ($1 == u) {
  600.     if ($_not($_ismask($2))) {
  601.       if ($address($2,5) == $null) _lookup $2 ! _Ubulksel u ,
  602.       else .timer -m 1 1 _Ubulksel u $address($2,5)
  603.       halt
  604.     }
  605.   }
  606.   sline @Userlist 1 | sline -r @Userlist 1
  607.   set %.tog.num $line(@Userlist,0)
  608.   :loop
  609.   if ($_Ubulksel2($1-2,$remove($strip($line(@Userlist,%.tog.num)),$chr(32)))) sline -a @Userlist %.tog.num
  610.   if ($_vd(.tog.num) > 4) goto loop
  611.   if ($sline(@Userlist,0) == 0) { titlebar @Userlist | _error No matching entries found. }
  612.   else titlebar @Userlist ( $+ $sline(@Userlist,0) matching $_plural2(entry,entries,$sline(@Userlist,0)) found)
  613. }
  614. _Ubulksel2 {
  615.   if ($1 == n) {
  616.     if ($2 iswm $gettok($3-,1,9)) return $true
  617.   }
  618.   elseif ($1 == m) {
  619.     if ($2 iswm $gettok($3-,2,9)) return $true
  620.   }
  621.   elseif ($1 == u) {
  622.     if ($gettok($3-,2,9) iswm $2) return $true
  623.   }
  624.   elseif ($1 isin <>!==) {
  625.     if ($gettok($3-,3,9) $1 $2) return $true
  626.   }
  627.   elseif ($1 == s) {
  628.     if ($findtok($gettok($3-,4,9),$2,44) != $null) return $true
  629.   }
  630.   elseif ($1 == w) {
  631.     if ($findtok($gettok($3-,4,9),$2,44) == $null) return $true
  632.   }
  633.   elseif ($1 == a) {
  634.     if ($gettok($3-,5,9) $2 (none)) return $true
  635.   }
  636.   elseif ($1 == o) {
  637.     if ($findtok($gettok($3-,5,9),$2,44) != $null) return $true
  638.   }
  639.   else {
  640.     set %.ctime $readini $_ppdir $+ userlist.ini seen $gettok($3-,2,9)
  641.     if (%.ctime != $null) {
  642.       set %.ctime $calc(($ctime - $gettok(%.ctime,1,32)) / 86400) 
  643.       if (%.ctime $1 $2) return $true
  644.     }
  645.   }
  646.   return $false
  647. }
  648. _cddc {
  649.   set %.new edit
  650.   if ($1 == play) set %.new play
  651.   elseif (($1 == $null) && (%cdp.click == edit)) set %.new play
  652.   set %cdp.click %.new
  653.   rline @CD 1 - Double-click will  $+ %cdp.click $+  track -
  654. }
  655. _cdtt set %.ln $sline(@CD,1).ln | if (%.ln > 6) cdtrack $calc(%.ln - 6) $1
  656. _fixr if (% [ $+ [ $1 ] ] isin -s-a) set % [ $+ [ $1 ] ] % [ $+ [ $1 ] ] $+ i2
  657.